Repository navigation
fix(components): action:button renders no text for a non-string label instead of crashing the page - #37262
Conversation
… instead of crashing the page Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D
…erer hands down Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D
|
repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D Final head for L1 · area a4-U · 2026-11-25T09:01Z
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — REWORK · L1 · head
|
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D
…'s own visible gate Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D
|
repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D Final head for the delta read (rework round 1) · area a4-U · 2026-11-25T12:57Z Against REWORK 7157997155. Dev report: 7162989235.
Handed to the seat session for the delta read. |
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — ACCEPT · L1 · head
|
|
repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D Landing · area a4-U · 2026-11-25T13:29Z · head
The seat's optional N1 (a dev-console-only raw label read in State change: ready for review, and auto-merge is armed. The queue lands it. On MERGED, #36717 closes through |
Fixes #36717
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
ui/packages/components/src/renderers/action/action-button.tsx: every read ofschema.labelgoes through one guard,renderableLabel. A string label is returned unchanged. Any other value (an inline locale map from metadata that skippedvalidateComponentProps) becomes no label: the button renders with no text and still runs its action, nothing prints[object Object], and a development build logs oneconsole.warnper component, keyed on the component id, naming the bundle keypages.PAGE.components.COMPONENT_ID.label. The dev warning follows the existingprocess.env.NODE_ENV !== 'production'pattern inauto-trigger.ts. The value is never translated, so a value the contract refuses gets no meaning.The guard covers all five label reads in the file: the
visiblediagnostic label, thelabelforwarded to the runner (the param dialog's title), the icon spacing class, the rendered text, and the subject handed touseAutoTriggerOnce. That hook builds its user-facing refusal toast and toast id from the label, so it now gets the guarded label ({ ...schema, label }when they differ).Ruling: option A (7118756694), the maintainer's 「保持走翻译包」.
labelstaysz.string()andpackages/specis untouched.Responsibility:
@object-ui/componentsaction:buttonrenderer;validateComponentProps(for example code-registered pages) and carry a non-string label.Tests
A new top-level
describefor #36717 in the existing action-button harnessaction-button-icon-inputs-11168.test.tsx, which mounts the node through the realSchemaRendererandActionProvider:[object Object]and neither locale string, and a second mount of the same component does not warn again (exactly one warning, which names the component id);autoTriggerbutton gives a refusal toast whose message and id carry no[object Object](it names the action byname), and no console warning carries it either;translatePagethroughpages.billing.components.buy_credits.labelrenders购买额度.Acceptance notes
5) rendered as text before this PR. It is now dropped like any other non-string label, with the same dev warning. The contract (z.string()) already refuses it, so this follows ruling A.action:menu,action:groupandaction:iconalso render a non-string label raw, andaction:menuthrows on a locale map. The follow-up is action:menu / action:group / action:icon render a non-string label raw (action:menu throws on a locale map) #37266.name. A button with neither shares the fallback keyaction:button, so only the first such button warns.Verification
Two-minute check:
pnpm --dir ui exec vitest run packages/components/src/renderers/action/__tests__/action-button-icon-inputs-11168.test.tsx -t "non-string label". Expected: 5 passed.Ablation of the auto-trigger hand-off (head fce37f7)
node scripts/ablation-replace.mjsput backuseAutoTriggerOnce(schema, isVisible, handleClick)(anchor 1 to 0, blob 60bb1f196925 to 426c38142ef3). Result: 1 failed, 4 passed. The failure:expected '"[object Object]" is not available on…' not to contain '[object Object]'. After the restore, the blob equals HEAD (60bb1f196925) andgit diff HEADis empty.The first version of this pin (da40a35) mounted the node through
SchemaRenderer. Its node gate hides avisible: falsenode before the renderer mounts, so the hook never ran and the toast was never called; that failed the same way locally and in CI. It was a mounting error, not timing. The pin now mounts the registered renderer directly, which is the pathaction:bartakes.Ablation (guard reverted, head e8894fd)
node scripts/ablation-replace.mjsreplaced the guard's string check withreturn label as string | undefined;. The anchor went from 1 to 0 hits and the blob from 212e6892b2cc to 4aa3e1708bd4. Result: 2 failed, 2 passed. Both object-label tests threw "Objects are not valid as a React child (found: object with keys {en, zh-CN})", which is the defect as it is on main. Both controls stayed green. After the restore, the blob equals HEAD (212e6892b2cc) andgit diff HEADis empty.Suites and gates (round 1 head e13c940; round 2 head fce37f7 below)
Round 2 at fce37f7:
pnpm --filter @object-ui/components type-check && vitest run packages/components/src/renderers/action/gave 37 files and 619 tests passed (VERDICT command-exit 0). The harness file gave 60/60.pnpm --filter @object-ui/components type-checkpassed, chained with&&beforevitest run packages/components/src/renderers/action/(38 files, 626 tests passed). VERDICT command-exit 0.Full
packages/components/suite on e8894fd: 510 files passed, 1 skipped; 4970 tests passed. The only later code change is the warning key (dataObjId), and the action-renderer directory was re-run on the final head.dispatch-gates --commands: 38 families derived and run;--ranaccounted for all 38. 37 exited 0 on e13c940.vitest run scripts/had one 15 s timeout under box contention (js-comment-mask-returns-interpolation-9424). That file passed on re-run under the lock on the final head.NOT MEASURED locally: the CI type-check lanes the derivation lists as CI-only, the CI-measured-only families, and Test UI shards beyond
packages/components.Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D